@extends('layouts.art')
@section('content')

  <a class="btn btn-primary" href="{{route('blog.create')}}">添加文章</a>
  <?php
    if(Auth::check()){
      $user = Auth::user();
      ?>
    <span style="position:absolute;right:40px;color:blue;font-size:20px;">用户名：{{$user->name}}</span>
  <a class="btn btn-primary" href="auth/logout">退出登录</a>

  <?php
    }else{
    ?>
  <a class="btn btn-primary" href="/login">登录</a>
  <a class="btn btn-primary" href="/register">注册</a>
  <?php
    }
    ?>
  

  <a class="btn btn-primary" href="/category">点击查看无限级分类</a>

  <a class="btn btn-primary" href="/addcart">购物车</a>

  <a class="btn btn-primary" href="/albums">相册</a>

  <a class="btn btn-primary" href="/user">用户列表</a>
	@foreach($articles as $article)
	<div class="panel panel-default">
	<div class="panel-body">
    {{$article->title}}
    <a href="{{route('blog.show',$article->id)}}" class="btn btn-info">阅读</a>
    <a href="{{route('blog.edit', $article->id)}}" class="btn btn-info">修改</a>

      <form action="{{ route('blog.destroy', $article->id) }}" method="post" style="display: inline-block;">
            {{ csrf_field() }}
            {{ method_field('DELETE') }}
            <button type="submit" class="btn btn-danger">删除</button>
        </form>
    </div>
    </div>
   @endforeach

  {!! $articles->render() !!}
 @endsection